package com.miracle.login.module.api;

import com.miracle.basemvp.base.BaseResponse;
import com.miracle.common.bean.User.User;
import com.miracle.common.mvp.entity.response.DandelionResponse;
import com.miracle.common.mvp.entity.response.VersionInfo;
import com.miracle.login.module.mvp.entity.request.LoginRequest;
import com.miracle.login.module.mvp.entity.request.RegisterRequest;
import com.miracle.login.module.mvp.entity.response.LoginResponse;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * LoginApi.java
 *
 *
 * @author WangJQ
 * @version 1.0
 * @date 2018/6/29 16:25
 * @see com.miracle.login.module.api
 */
public interface LoginApi {
    /**
     * 登陆
     * @param request
     * @return
     */
    @POST("login")
    Observable<BaseResponse<User>> login(@Body LoginRequest request);

    /**
     * 注册
     * @param request
     * @return
     */
    @POST("register")
    Observable<BaseResponse<String>> register(@Body RegisterRequest request);

    /**
     * 获取最新版本
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("https://www.pgyer.com/apiv2/app/view")
    Observable<DandelionResponse<VersionInfo>> checkVersion(@Field("_api_key") String apiId, @Field("appKey") String appkey);

}
